#include "widget.h"
#include "ui_widget.h"
#include<QFileDialog>
#include<QFile>
#include<QString>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QString path = QFileDialog::getOpenFileName(this,"打开文件","./");
    ui->lineEdit->setText(path);
    QFile file(path);
    file.open(QIODevice::ReadOnly);
    QString msg = file.readAll();
    ui->textEdit->setText(msg);
}
